<?php echo $this->render('/manage/header.phtml');?>
<script type="text/javascript">
$(function(){
	//删除文章js
	$(".deleteAtc").click(function(){
		var delConf = confirm('确认删除?');
		if (delConf) {
			var aid = $(this).attr('aid');
			$.ajax({
				type : 'POST',
				url : '/manage/delete-post',
				dataType : 'json',
				data : {'id' : aid},
				success : function (data) {
					if (data.errorcode == 0) {
						alert('删除成功');
						window.location.reload();
					} else {
						alert(data.errormsg);
					}
				},
				error : function(data) {
					alert('网络超时!');
				}
			});
		}
	});

	$("#selectCate").change(function(){
		var cateId = $(this).val();
		window.location.href="/manage/info/cateid/" + cateId;
		return false;
	});
});
</script>
</head>
<body>
<div id="body-wrapper">
<?php echo $this->render('/manage/sidebar.phtml');?>
<div id="main-content">
    <h2><?php echo $this->title;?></h2>
    <ul class="shortcut-buttons-set">
      <li>
      	<a class="shortcut-button" href="/manage/add-post"><span> <img src="/public/images/admin/icons/pencil_48.png" alt="icon"><br>
        添加信息</span></a>
      </li>
    </ul>
    <div class="clear"></div>
    <div class="content-box">
      <div class="content-box-header">
        <h3>Content box</h3>
        <div class="clear"></div>
      </div>
      <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
			<h1 class="title"><?php echo $this -> title;?></h1>
	        <div class="content">
	        <div class="notification information png_bg"> <a href="#" class="close"><img src="/public/images/admin/icons/cross_grey_small.png" title="Close this notification" alt="close"></a>
				<div>注：除“公司简介”外，其他分类后台添加之后前台只显示最新修改的一条记录。</div>
			</div>
	        选择产品分类：
	        <select name="cateid" id="selectCate">
	        	<?php foreach ($this->cates as $value) {?>
	        	<option <?php if ($this->cateId == $value['id']) {echo 'selected="selected"';}?> value="<?php echo $value['id'];?>"><?php echo $value['name'];?></option>
	        	<?php }?>
	        </select>
			<table>
            <thead>
              <tr>
                <th>ID</th>
                <th>产品名称</th>
                <th>操作</th>
              </tr>
            </thead>
            <tfoot>
              <tr>
                <td colspan="6">
                  <div class="pagination">
					<a href="/manage/info/cateid/<?php echo $this->cateId;?>/page/1" title="First Page">« First</a>
					<a href="/manage/info/cateid/<?php echo $this->cateId;?>/page/<?php echo $this->page - 1;?>" title="Previous Page">« Previous</a>
					<?php if ($this->page < 6) {?>
					 	<?php for ($i = 1; $i < 11; $i++) {?>
					 		<?php if ($i == $this->page) {$style = " current";} else {$style = "";}?>
					 		<a href="/manage/info/cateid/<?php echo $this->cateId;?>/page/<?php echo $i;?>" class="number<?php echo $style;?>"><?php echo $i;?></a>
					 		<?php if ($i == $this->total) {break;}?>
					 	<?php }?>
				 	<?php } else { ?>
				 		<?php for ($i = $this->page - 4; $i < $this->page + 6; $i++) {?>
				 			<?php if ($i == $this->page) {$style = " current";} else {$style = "";}?>
					 		<a href="/manage/info/cateid/<?php echo $this->cateId;?>/page/<?php echo $i;?>" class="number<?php echo $style;?>"><?php echo $i;?></a>
					 		<?php if ($i == $this->total) {break;}?>
					 	<?php }?>
				 	<?php }?>
					<a href="/manage/info/cateid/<?php echo $this->cateId;?>/page/<?php echo $this->page + 1;?>" title="Next Page">Next »</a>
					<a href="/manage/info/cateid/<?php echo $this->cateId;?>/page/<?php echo $this->total;?>" title="Last Page">Last »</a>
				  </div>
                  <div class="clear"></div>
                </td>
              </tr>
            </tfoot>
            <tbody>
            <?php foreach ($this->newsList as $key => $value) {?>
              <tr>
                <td><?php echo $value['id'];?></td>
                <td><a href="/manage/edit-post/id/<?php echo $value['id'];?>"><?php echo $value['title'];?></a></td>
                <td>
                  <a href="/manage/edit-post/id/<?php echo $value['id'];?>" title="Edit"><img src="/public/images/admin/icons/pencil.png" alt="Edit"></a>
                  <a class="deleteAtc" href="###" title="Delete" aid="<?php echo $value['id'];?>"><img src="/public/images/admin/icons/cross.png" alt="Delete"></a>
              	</td>
              </tr>
              <?php }?>
            </tbody>
          </table>
	        </div>          
        </div>
      </div>
    </div>
    <div class="clear"></div>
<?php echo $this->render('/manage/footer.phtml');?>
</div>
</div>
</body>
</html>